package com.game.data.vo
{
	import base.BaseVO;
	
	import com.dusk.util.ArrayUtil;
	
	import com.dusk.util.KeyboardUtil;
	
	import flash.ui.Keyboard;
	
	public class KeyConfigVO extends BaseVO
	{
		public function KeyConfigVO()
		{
			super();
		}
		
		public var up:int = Keyboard.W;
		public var down:int = Keyboard.S;
		public var left:int = Keyboard.A;
		public var right:int = Keyboard.D;
		public var attack:int = Keyboard.J;
		public var jump:int = Keyboard.K;
		
		public var skill1:int = Keyboard.Y;
		public var skill2:int = Keyboard.U;
		public var skill3:int = Keyboard.I;
		public var skill4:int = Keyboard.O;
		public var skill5:int = Keyboard.L;
		public var skillSpecial:int = Keyboard.SPACE;
		
		public var openBag:int = Keyboard.C;
		public var openSkill:int = Keyboard.V;
		public var openPet:int = Keyboard.B;
		public var openSetting:int = Keyboard.E;
		
		public var useSutra:int = Keyboard.H;
		
		public function getAllKeyCode():Array
		{
			var keyArray:Array = [];
			for(var key:String in classDescription)
			{
				keyArray.push(parseInt(key));
			}
			return keyArray;
		}
		
		public function hasRepeatKey():Boolean
		{
			return getAllKeyCode().length != ArrayUtil.filterKeepOne(getAllKeyCode()).length;
		}
		
		public function getSkillKeyByIndex(index:int):String
		{
			return KeyboardUtil.getKeyNameByKeyCode(this["skill" + index]);
		}
	}
}
